package com.atguigu.java;

import java.nio.ByteBuffer;
import java.util.Scanner;

/**
 * ClassName: BufferTest
 * Description:
 * Date: 2021/3/8 21:51
 * Company: TravelSky
 *
 * @author YangXin
 */
public class BufferTest {

    private static final int BUFFER = 1024 * 1024 * 1024;

    public static void main(String[] args) {
        ByteBuffer byteBuffer = ByteBuffer.allocateDirect(BUFFER);
        System.out.println("直接内存分配完毕...");

        Scanner sc = new Scanner(System.in);
        sc.next();

        System.out.println("直接内存开始释放!");
        byteBuffer = null;
        System.gc();
        sc.next();
    }
}
